// https://nuxt.com/docs/api/configuration/nuxt-config
import eslint from 'vite-plugin-eslint2';

export default defineNuxtConfig({
  compatibilityDate: '2024-11-01',
  devtools: { enabled: true },
  eslint: {
    checker: true,
  },
  vite: {
    plugins: [
      eslint({
        exclude: ['node_modules', '.nuxt', 'dist'],
      }),
    ],
  },
  modules: [
    '@nuxt/eslint',
    '@nuxt/fonts',
    '@nuxt/icon',
    '@nuxt/image',
    '@nuxt/ui',
    '@nuxt/scripts',
    '@nuxt/test-utils',
    '@unocss/nuxt',
    '@nuxtjs/i18n',
    'dayjs-nuxt',
    '@element-plus/nuxt',
  ],
  i18n: {
    langDir: '../locales/',
    defaultLocale: 'zh',
    detectBrowserLanguage: {
      useCookie: true,
      cookieKey: 'i18n_redirected',
      alwaysRedirect: true,
      // redirectOn: 'root'
    },
    bundle: {
      optimizeTranslationDirective: false,
    },
    // strategy: 'prefix_except_default',
    strategy: 'no_prefix',
    locales: [
      {
        code: 'zh',
        file: 'zh.ts',
        name: '简体中文',
      },
      {
        code: 'en',
        file: 'en.ts',
        name: 'English',
      },
    ],
  },
  css: ['~/assets/style/global.less'],
});